<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="/index/css/font/iconfont.css">
    <link rel="stylesheet" href="/index/css/iframe.css">

    <title>文娱</title>
    <style>


    </style>
</head>
<body>
    <div class="header">
        <a href="/"><i class="iconfont">&#xe62c;</i></a>
        <!--<i class="iconfont float-right">&#xe617;</i>-->

        <p id="title">{if $title} {$title} {else/} 掌间文娱{/if}</p>
        <!--<i class="iconfont">&#xe620;</i>-->
        <!--<i class="iconfont">&#xe61f;</i>-->

    </div>
    <div class="iframe">
        <iframe id="main-frame" src="{$url}"  frameborder="0"></iframe>
    </div>
</body>
<script>
    // var iframe = document.getElementById('main-frame');
    // iframe.onload = function() {
    //
    //     var href = this.contentWindow.location.href
    //     console.log(href);
    // }
    window.onload = function(){
        var mainFrame=document.getElementById('main-frame');

        var title = mainFrame.contentWindow.document.title;//iframe中子页面的title

        console.log(title);
        document.getElementById('title').innerText = title;
    }

</script>
</html>